#include "DaoFactory.h"

DaoFactory * DaoFactory::instance = 0;

DaoFactory::DaoFactory(void){
	this->daoMap["Frog"] = new FrogDao();
	this->daoMap["Drainage"] = new DrainageDao();
	this->daoMap["Rail"] = new RailDao();
	this->daoMap["Texture"] = new TextureDao();
	this->daoMap["Stage"] = new StageDao();
	this->daoMap["Source"] = new SourceDao();
	this->daoMap["Obstacle"] = new SourceDao();
}

DaoFactory::~DaoFactory(void){
	delete DB::getInstance();
	delete this->daoMap["Frog"];
	delete this->daoMap["Drainage"];
	delete this->daoMap["Rail"];
	delete this->daoMap["Texture"];
	delete this->daoMap["Stage"];
	delete this->daoMap["Source"];
	delete this->daoMap["Obstacle"];
}

DaoFactory* DaoFactory::getInstance(){
	if(!instance){
		instance = new DaoFactory();
	}
	return instance;
}

AbstractDao * DaoFactory::getDao( string type ){
	return daoMap[type];
}
